package kr.ac.kaist.simplefileexplorer;

import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.List;

import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.BitmapFactory.Options;
import android.net.Uri;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.google.api.services.drive.model.File;

public class GoogleFileListAdapter extends ArrayAdapter<File> {

	private int resource;
	private LayoutInflater inflater;
	private Context context;
	
	int kindsOfMenu;
	
	public GoogleFileListAdapter(Context ctx, int resourceId, List<File> objects){
		super(ctx, resourceId, objects);
		resource = resourceId;
		inflater = LayoutInflater.from(ctx);
		context = ctx;
	}
	
	@Override 
	public View getView(int position, View convertView, ViewGroup parent){
		convertView = (LinearLayout)inflater.inflate(resource,null);
		
		File fileInfo = getItem(position);
		
		TextView fileName = (TextView)convertView.findViewById(R.id.file_name);
		fileName.setText(fileInfo.getTitle().toString());	

		ImageView fileImage = (ImageView)convertView.findViewById(R.id.file_type_image);
		fileImage.setImageResource(R.drawable.general_doc);
		
		return convertView;
	}
	
}